<?php
    include('inc/db.php');
    include('template/_header.php');
?>

<div id="contact">
    <div id="twitter">
     &nbsp @ooxx 暂未开放！ - XX<a href="http://twitter.com/">Twitter</a>
    </div>
<div id="post">
    <?php
        if($_GET['keywords']) {
            $where="WHERE instr(title, '".$_GET['keywords']."')";
        }
        $sql = "SELECT * FROM post $where ORDER BY id DESC LIMIT 0,10";
        $result = mysql_query($sql);
        $i=0;
        while($row = mysql_fetch_array($result)){
            $id=$row['id'];
            echo '<h3>'.'<a href="riji.php?id='.$id.'">'.$row['title'].'</a>'.'</h3>';
            if($i==0) {
                echo '<br />'.'<div class='.'"post-content"'.'>';
                echo $row['content'].'</div>';
            }
            $i=$i+1;
        }
    ?>
     
    <p class='search'><center>
        <label for="keywords">
            »
            <a href="list.php">由此查看所有文章</a>
            ，或者搜索：
        </label>
    <form method="get" action="">
        <input id="keywords" type="text" size="45" value="" name="keywords"/>
        <span class="submit">
            <input type="submit" value="搜索"/>
        </span>
        </form></center>
    </p>
</div>
<?php
    include('template/_footer.php');
?>
</div>
</body>
</html>
